<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form action="${path}/onlineLink/save" id="fm" method="post" enctype="multipart/form-data" class="definewidth m20">
		<input type="hidden" value="${(onlineLink.id)!0}" name="id">
		<div style="text-align: center;" id="errorMsg">${msg!}</div>
		<table class="table table-bordered table-hover definewidth m10">
			<tr>
				<td width="10%" class="tableleft">标题<span class="required">*</span></td>
				<td><input type="text" name="title" value="${(onlineLink.title)!}" datatype="*" nullmsg="请输入标题！"/></td>
			</tr>
			<tr>
				<td class="tableleft">描述 </td>
				<td><textarea rows="3" cols="*" name="content">${(onlineLink.content)!}</textarea></td>
			</tr>
			<tr>
				<td class="tableleft">排序<span class="required">*</span></td>
				<td><input type="text" name="sort" value="${(onlineLink.sort)!}" datatype="n"/></td>
			</tr>
			<tr>
				<td class="tableleft">链接<span class="required">*</span></td>
				<td><input type="text" name="buyLink" value="${(onlineLink.buyLink)!}" datatype="url" errormsg="请填写正确的网址！"/></td>
			</tr>
			<tr>
				<td class="tableleft">
					<#if (imgLogoPath)??>
						<a target="_blank" href="${imgLogoPath!}">logo</a>
						<input type="hidden" name="imgLogo" value="${(onlineLink.imgLogo)!}"/>
					<#else>logo</#if>
					<#if !(onlineLink)??><span class="required">*</span></#if></td>
				<td><input type="file" name="imgLogoFile" accept="image/jpeg,image/png" <#if !(onlineLink)??>datatype="*"</#if> nullmsg="请选择logo！"/>
					<span class="tips">推荐200*200</span>
				</td>
			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn btn-success" name="backid"
						id="backid">返回列表</button>
				</td>
			</tr>
		</table>
	</form>
	<@h.foot />
<script type="text/javascript">
	$(function() {
		$('#backid').click(function() {
			window.location.href = "${path}/onlineLink/list";
		});
	});
	$(function() {
		$("[name=buyLink]").blur(function() {
			if($(this).val().trim()!="" && !$(this).val().startsWith("http") && !$(this).val().startsWith("https")) {
				$(this).val("http://" + $(this).val());
			}
		});
	});
	$("#fm").Validform({
		tiptype : 3,
		postonce : true
	});
</script>
</body>
</html>